home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / SPX30.ZIP / SPX_INT.ZIP / SPX_GUI.INT < prev    next >
Encoding:
Text File  |  1994-06-10  |  9.6 KB  |  226 lines

  1. Unit spx_gui;
  2.  
  3. {$X+,O+ }
  4. { SPX Library Version 3.0  Copyright 1994 Scott D. Ramsay }
  5.  
  6. Interface
  7.  
  8. Uses crt,dos,objects,spx_vga,spx_key,spx_vsp,spx_dos,spx_obj,spx_fnc,spx_sfn,spx_mos;
  9.  
  10. const
  11.   id_button = 1100;       { button id numbers }
  12.   id_string = 1101;
  13.   id_check  = 1102;
  14.   id_radio  = 1103;
  15.   id_scroll = 1104;
  16.   id_pbox   = 1105;
  17.  
  18.  { system color index values }
  19.   sysc_black      = 0;                  { black }
  20.   sysc_background = 1;                  { background }
  21.   sysc_medbkgnd   = 2;                  { medium shade background }
  22.   sysc_darkbkgnd  = 3;                  { dark shade background }
  23.   sysc_text       = 4;                  { default text }
  24.   sysc_textshadow = 5;                  { default text shadow color }
  25.   sysc_highlite1  = 6;                  { highlight text 1 }
  26.   sysc_highlite2  = 7;                  { highlight text 2 }
  27.  
  28.   mLeftButton  = 1;    { button action values for the MMASK variable }
  29.   mRightButton = 2;
  30.   mBothButtons = 3;
  31.  
  32.   WinUpdate  : boolean = true; { FALSE - don't update save back on offwin call }
  33.   DiskVerify : boolean = true; { TRUE - Check within diskdo if file exist or can overwrite }
  34.  
  35. type
  36.   Tattr       = record
  37.                   x,y,w,h : integer;
  38.                 end;
  39.   Pbutton     = ^Tbutton;
  40.   Pobjlist    = ^Tobjlist;
  41.   itempos     = (center,top,left,bottom,right);
  42.   vcolortypes = array[0..7] of byte;
  43.   wcolortypes = array[0..7] of rgbtype;
  44.   Tproc_a     = procedure(p:pbutton);
  45.   Tproc_b     = procedure(p:pbutton;on:boolean);
  46.   Tbutton     = object(tobjs)
  47.                   idnum            : word;
  48.                   tch              : char;
  49.                   mmask            : byte;
  50.                   attr             : Tattr;
  51.                   title            : string;
  52.                   titlex,titley    : itempos;
  53.                   tfunct,
  54.                   visible,disabled : boolean;
  55.                   cdraw,caction    : Tproc_a;
  56.                   cnear            : Tproc_b;
  57.                    root             : Pobjlist;
  58.                   res1             : pointer;
  59.                   msg              : string;
  60.                   constructor init(x,y,w,h,idn:integer;ch:char;fnc:boolean;t:string);
  61.                   constructor Load(var S:TStream);
  62.                   procedure Store(var S:TStream);
  63.                   procedure drawitemobject;virtual;
  64.                   procedure nearitemobject(on:boolean);virtual;
  65.                   procedure actionitemobject;virtual;
  66.                   procedure showpress;virtual;
  67.                   procedure show(on:boolean);virtual;
  68.                   function ncheckhit(hx,hy,ohx,ohy:integer;item:pobjlist):boolean;virtual;
  69.                   destructor done;virtual;
  70.                 end;
  71.   Pstring     = ^Tstring;
  72.   Tstring     = object(Tbutton)
  73.                   esx,esy,epx,epy : integer;
  74.                   objectx,objecty : itempos;
  75.                   spaceok,upper,
  76.                   numonly         : boolean;
  77.                   tlenmax         : byte;
  78.                   tstr            : string;
  79.                   constructor init(x,y,w,h,idn:integer;ch:char;fnc:boolean;t,t2:string;tmax:byte);
  80.                   procedure drawitemobject;virtual;
  81.                   procedure showpress;virtual;
  82.                   procedure filename(px,py:integer;var fname:string);
  83.                 end;
  84.   Pcheck      = ^Tcheck;
  85.   Tcheck      = object(Tstring)
  86.                   tchk : boolean;
  87.                   constructor init(x,y,w,h,idn:integer;ch:char;fnc:boolean;t:string;chk:boolean);
  88.                   procedure drawitemobject;virtual;
  89.                   procedure show(on:boolean);virtual;
  90.                   procedure showpress;virtual;
  91.                   procedure actionitemobject;virtual;
  92.                 end;
  93.   Pradio      = ^Tradio;
  94.   Tradio      = object(Tcheck)
  95.                   group : integer;
  96.                   constructor init(x,y,w,h,idn,grp:integer;ch:char;fnc:boolean;t:string;chk:boolean);
  97.                   procedure drawitemobject;virtual;
  98.                   procedure show(on:boolean);virtual;
  99.                   procedure showpress;virtual;
  100.                   procedure actionitemobject;virtual;
  101.                 end;
  102.   Pscroll     = ^Tscroll;
  103.   Tscroll     = object(Tbutton)
  104.                   horz      : boolean;
  105.                   tx1,ty1,
  106.                   tx2,ty2,
  107.                   pvlu,siz,
  108.                   bmin,bmax,
  109.                   bpos,binc : integer;
  110.                   constructor init(x,y,w,h,idn,min,max,bi,bp:integer;hz:boolean);
  111.                   procedure showpress;virtual;
  112.                   procedure drawitemobject;virtual;
  113.                   procedure redrawscroll;
  114.                   function porp(vlu,max,min,p1,p2,wd:integer):integer;
  115.                 end;
  116.   Ppbox       = ^Tpbox;
  117.   Tpbox       = object(Tbutton)
  118.                   objs  : Pobjlist;
  119.                   sh,st : plist;
  120.                   lhstr : string;
  121.                   lhdat : longint;
  122.                   items : integer;
  123.                   constructor init(x,y,w,i,idn:integer;t:string);
  124.                   function ncheckhit(hx,hy,ohx,ohy:integer;item:Pobjlist):boolean;virtual;
  125.                   procedure drawitemobject;virtual;
  126.                   procedure additem(s:string;d:longint;draw:boolean);virtual;
  127.                   function delitem(s:string;d:longint;draw:boolean):boolean;virtual;
  128.                   function getcount:integer;virtual;
  129.                   procedure show(on:boolean);virtual;
  130.                   destructor done;virtual;
  131.                  private
  132.                   listb : pbutton;
  133.                   lists : pscroll;
  134.                   last,
  135.                   stop  : plist;
  136.                   procedure drawitemat(yv,oyv:integer;draw:boolean);virtual;
  137.                   procedure fixscroller;virtual;
  138.                 end;
  139.   Pkey_io     = ^Tkey_io;
  140.   Tkey_io     = object
  141.                   funct : boolean;
  142.                   ch    : char;
  143.                   constructor init(h:char;f:boolean);
  144.                   procedure inkey; virtual;
  145.                   function apress : boolean; virtual;
  146.                   procedure clearbuffer; virtual;
  147.                   destructor done; virtual;
  148.                 end;
  149.   Pmouse_io   = ^Tmouse_io;
  150.   Tmouse_io   = object(Tkey_io)
  151.                   mpx,mpy,opx,opy,
  152.                   mdx,mdy,
  153.                   mop,lmop,lx,ly,x,y : integer;
  154.                   constructor init(h:char;f:boolean;sx,sy,m:integer);
  155.                   procedure inkey; virtual;
  156.                   function apress : boolean; virtual;
  157.                   function mousepressed : boolean; virtual;
  158.                   procedure clearbuffer; virtual;
  159.                   destructor done; virtual;
  160.                 end;
  161.   Tobjlist    = object
  162.                   head,tail : plist;
  163.                   io        : Pmouse_io;
  164.                   focus     : pbutton;
  165.                   gmsg      : string;
  166.                   orange    : pbutton;                  
  167.                   constructor init;
  168.                   procedure inkey;virtual;
  169.                   procedure clearbuffer;virtual;
  170.                   function addobject(item:Pbutton):Pbutton;virtual;
  171.                   function checkpress(var p:pbutton):integer;virtual;
  172.                   function retobject(hnd:integer):pbutton;virtual;
  173.                   procedure showall;virtual;
  174.                   destructor done;virtual;
  175.                  private
  176.                   rmop,
  177.                   rmx,rmy,
  178.                   romx,romy : integer;                  
  179.                 end;
  180.  
  181. const
  182.   cl            : vcolortypes = (0,23,31,8,15,8,9,28); { System colors }
  183.   defaultcolors : wcolortypes =                        { System want colors }
  184.                  ((red:00;green:00;blue:00),           { background - black }
  185.                   (red:35;green:35;blue:35),           { object background  }
  186.                   (red:49;green:49;blue:48),           { Medium Shade       }
  187.                   (red:21;green:21;blue:21),           { Dark Shade         }
  188.                   (red:63;green:63;blue:63),           { Text, Light Shade  }
  189.                   (red:21;green:21;blue:21),           { Generic medium     }
  190.                   (red:21;green:21;blue:63),           { Highlite 1         }
  191.                   (red:53;green:14;blue:14));          { Highlite 2         }
  192.   burntsienna   : wcolortypes =
  193.                  ((red:00;green:00;blue:00),
  194.                   (red:48;green:28;blue:00),
  195.                   (red:54;green:35;blue:00),
  196.                   (red:35;green:15;blue:00),
  197.                   (red:63;green:63;blue:63),
  198.                   (red:35;green:15;blue:00),
  199.                   (red:58;green:57;blue:18),
  200.                   (red:00;green:63;blue:45));
  201.  
  202. var
  203.   drives     : string[26] ;
  204.   driveset   : set of 'A'..'Z';
  205.   gx,gy      : integer;
  206.   menucolors : wcolortypes;
  207.  
  208. function strlen(s:string):word;
  209. procedure textpos(title:string;tx1,ty1,tx2,ty2:integer;txpos,typos:itempos;var ux,uy:integer);
  210. procedure pointpos(tx1,ty1,tx2,ty2:integer;txpos,typos:itempos;var ux,uy:integer);
  211. procedure drawstring(x,y:integer;s:string;c1,c2:byte);
  212. procedure vgaborder(x1,y1,x2,y2:integer;border:boolean);
  213. procedure vgainvr(x1,y1,x2,y2:integer;border:boolean);
  214. procedure vgarect(x1,y1,x2,y2:integer);
  215. procedure vgabox(x1,y1,x2,y2:integer);
  216. function onwin(x,y,w,h:integer;border:boolean):boolean;
  217. procedure offwin;
  218. procedure message(s:string;wait:boolean);
  219. function yes(msg:string):boolean;
  220. function diskdo(x,y:integer;fpath,mask,title:string;loading:boolean):string;
  221. procedure finddrives;
  222. function writeable(pth:string):boolean;
  223. procedure adjustmenupalette; { changes menu index colors (CL) to match }
  224.                              { the (menucolor) colors                  }
  225.  
  226.